package action;

import modele.Client;
import modele.Film;
import modele.Pret;

import com.opensymphony.xwork2.ActionSupport;

import data.ClientXML;
import data.FilmXML;
import data.PretXML;

public class SupprimePret extends ActionSupport {

	private static final long serialVersionUID = 3950635267464727091L;
	private int idPret;
	private int idFilm;
	private String titre;
	private int idClient;

	private Client[] listeClients;

	public String execute() throws Exception {
		ClientXML clientXML = new ClientXML();
		listeClients = clientXML.getListeClients();
		return SUCCESS;
	}

	public String supprimer() {

		PretXML pretXML = new PretXML(); 
		Pret pret = new Pret(idPret, idFilm, idClient);
		pretXML.supprimerPret(pret);
		FilmXML filmXML = new FilmXML();
		Film film = filmXML.getFilm(idFilm);
		film.setEstDispo(true);
		filmXML.modifierFilm(film);
		return SUCCESS;
	}

	public int getIdPret() {
		return idPret;
	}

	public void setIdPret(int idPret) {
		this.idPret = idPret;
	}
	
	public Client[] getListeClients() {
		return listeClients;
	}

	public void setListeClients(Client[] listeClients) {
		this.listeClients = listeClients;
	}

	public int getIdFilm() {
		return idFilm;
	}

	public void setIdFilm(int idFilm) {
		this.idFilm = idFilm;
	}

	public String getTitre() {
		return titre;
	}

	public void setTitre(String titre) {
		this.titre = titre;
	}

	public int getIdClient() {
		return idClient;
	}

	public void setIdClient(int idClient) {
		this.idClient = idClient;
	}

}